<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    .wzy__mask {
        background-color: rgba(0, 0, 0, 0.3);
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 999;
    }

    .wzy__box {
        background-color: #fff;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 30%;
        height: 220px;
        z-index: 1000;
    }

    .wzy__box .wzy__head {
        text-align: left;
        font-size: 18px;
        padding: 10px 20px;
        box-sizing: border-box;
        border-bottom: 1px solid #ddd;
    }

    .wzy__box .wzy__body {
        text-align: left;
        font-size: 14px;
        padding: 20px 20px 10px;
    }

    .wzy__box .wzy__footer {
        position: absolute;
        bottom: 0;
        left: 0;
        text-align: center;
        font-size: 14px;
        padding: 10px 20px;
        width: 100%;
    }


    .wzy__close__icon {
        display: inline-block;
        width: 10px;
        height: 10px;
    }

    .wzy__btn {
        width: 100px;
        height: 40px;
        background-color: #fff;
        border-radius: 4px;
        line-height: 40px;
        text-align: center;
        margin: 0 10px
    }

    .wzy__btn:hover {
        color: #409eff;
        border-color: #c6e2ff;
        background-color: #ecf5ff;
    }

    .wzy__true__btn {
        background-color: #409eff;
        border: 1px solid #409eff;
        color: #fff;
    }


    .wzy__false__btn {
        border: 1px solid #dcdfe6;
    }
</style>

<body>
    <button onclick="showDliag(success,faile)">普通弹窗</button>
</body>
<script>
    /*
        options:{
            弹窗名字
        }
    */
    function showDliag(success, faile) {
        var son = document.createElement("div");
        son.className = "wzy__mask";
        var box = document.createElement("div");
        box.className = "wzy__box";
        var dliagHead = document.createElement("div");
        dliagHead.className = "wzy__head";
        dliagHead.innerText = "弹窗";
        var closeIcon = document.createElement("i");
        closeIcon.className = "wzy__close__icon"
        box.appendChild(dliagHead);
        var dliagBody = document.createElement("div");
        dliagBody.className = "wzy__body";
        dliagBody.innerHTML = "我想说的事,你们千万不要害怕!";
        box.appendChild(dliagBody);
        var dliagFooter = document.createElement("div");
        dliagFooter.className = "wzy__footer";
        var trueBtn = document.createElement("button");
        trueBtn.className = "wzy__btn wzy__true__btn";
        trueBtn.innerText = "确定";
        trueBtn.onclick = success;
        dliagFooter.appendChild(trueBtn);
        var falseBtn = document.createElement("button");
        falseBtn.className = "wzy__btn wzy__false__btn";
        falseBtn.innerText = "取消";
        falseBtn.onclick = faile;
        dliagFooter.appendChild(falseBtn);
        box.appendChild(dliagFooter);
        document.querySelector("body").appendChild(son).appendChild(box);
    }



    function success() {
        alert("我们是警察,我们不会怕");
    }

    function faile() {
        alert("你说的我们好方");
    } 
</script>

</html>